package com.Smart.smartscals.Fragment;

import com.Smart.smartscals.Activity.ActivityGuide;
import com.Smart.smartscals.Activity.R;
import com.Smart.smartscals.Utils.Tools;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;

import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class BaseFragment extends Fragment implements OnClickListener,
		OnTouchListener {
	public View mView;
	public ActivityGuide mActivityGuide;

	public Button btnNext, btnBack;
	public TextView tvUpBig, tvDownSmall;
	public LinearLayout layBack;

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		view.setOnTouchListener(this);
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub

	}

	/**
	 * 初始化底部的Button
	 */
	public void initButton() {
		btnBack = (Button) mView.findViewById(R.id.btn_guide_back);
		btnNext = (Button) mView.findViewById(R.id.btn_guide_next);
	}

	/**
	 * 初始化顶部的Tv
	 */
	public void initToastTvBigSmall() {

		tvUpBig = (TextView) mView.findViewById(R.id.guide_name_tv_middle_big);
		tvDownSmall = (TextView) mView
				.findViewById(R.id.guide_name_tv_middle_small);
	}

	public void initTopImgBtn() {
		layBack = (LinearLayout) mView.findViewById(R.id.guide_linelayout_top_back);
	}

	/**
	 * 设置监听事件
	 */
	public void initNextLastBtnListener() {

		btnBack.setOnClickListener(this);
		btnNext.setOnClickListener(this);
	}

	/**
	 * 设置顶部显示的TextView
	 * 
	 * @param resIdSmall
	 * @param resIdBig
	 */
	public void setTextSmallBig(int resIdSmall, int resIdBig) {
		tvDownSmall.setText(resIdBig);
		tvUpBig.setText(resIdSmall);

	}

	

	@Override
	public boolean onTouch(View arg0, MotionEvent arg1) {
		/**
		 * 防止Fragmnt重叠后，事件叠加了。
		 */
		return true;
	}

	public void backDoJob(BaseFragment baseFragmentLastTime) {
		mActivityGuide.onBackPressed();
		mActivityGuide.setBaseFragmentLastTime(baseFragmentLastTime);

	}
}
